package br.com.firula.to;

import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

@Entity
@Table(name="jogo")
@SequenceGenerator(name="SEQUENCE", sequenceName="jogo_seq")
@Inheritance(strategy=InheritanceType.JOINED)
public class JogoTO extends BaseTO{

	private static final long serialVersionUID = -1417393249722187037L;

	@Id
	@Column(name="id", nullable=false)
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private Long id;

	@Column(name="data")
	private Date data;

	@Column(name="rodada")
	private Integer rodada;

	@ManyToMany(fetch = FetchType.LAZY, mappedBy="jogos", targetEntity=TimeTO.class)
	private List<TimeTO> times;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "idCampeonato", nullable = false)
	private CampeonatoTO campeonato;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Date getData() {
		return data;
	}

	public void setData(Date data) {
		this.data = data;
	}

	public Integer getRodada() {
		return rodada;
	}

	public void setRodada(Integer rodada) {
		this.rodada = rodada;
	}

	public List<TimeTO> getTimes() {
		return times;
	}

	public void setTimes(List<TimeTO> times) {
		this.times = times;
	}

	public CampeonatoTO getCampeonato() {
		return campeonato;
	}

	public void setCampeonato(CampeonatoTO campeonato) {
		this.campeonato = campeonato;
	}

	@Override
	public String getAbreviation() {
		// TODO Auto-generated method stub
		return null;
	}

}
